#ifndef VM_CRC_32_H_INCLUDED
#define VM_CRC_32_H_INCLUDED
/*****************************************************************************/
/*                              HEADER FILE                                  */
/*****************************************************************************/
/*
          $Archive:   $

         $Revision:   $

      Last Checkin:
             $Date:   $
                By:
           $Author:   $

 Last Modification:
          $ModTime:   $

       Description:   This file is part of a project downloaded from the web.
                      It has been reformatted and significantly cleaned up so
                      may not resemble the original file very much at all. The
                      original authors comments follow:

                      VMCrc32.cpp : implementation file for the VMCrc32 class
                                   written by PJ Arends
                                   pja@telus.net

                      based on the CRC-32 code found at
                      http://www.createwindow.com/programming/crc32/crcfile.htm

                      For updates check http://www3.telus.net/pja/crc32.htm

                      This code is provided as is, with no warranty as to it's 
                      suitability or usefulness in any application in which it 
                      may be used. This code has not been tested for UNICODE
                      builds, nor has it been tested on a network (with UNC paths).

                      This code may be used in any way you desire. This file may be
                      redistributed by any means as long as it is not sold for 
                      profit, and providing that this notice and the authors name
                      are included.

                      If any bugs are found and fixed, a note to the author explaining
                      the problem and fix would be nice.

                      created : October 2001
*/
/*****************************************************************************/


#if _MSC_VER > 1000
#pragma once
#endif

#ifndef _WINDOWS_
#include <windows.h>
#endif

#define VM_WM_CRC_THREAD_DONE WM_APP + 0x2BD1


class VMCrc32
{
public:
  VMCrc32( void );
  DWORD CalcCRC( LPCTSTR pchFileName, HWND hWndProgress = NULL );
  DWORD CalcCRC( LPVOID  pvBuffer,    UINT iBufferSize,   HWND hWndProgress = NULL );

private:
  static DWORD WINAPI CRC32ThreadProc( LPVOID lpVoid );
  void   Calculate( const LPBYTE pbBuffer, UINT iBufferSize, ULONG& rulOutput );
  ULONG  Reflect( ULONG ulToReflect, char chBitCount );

  ULONG  m_aulTable[ 256 ];
};


typedef struct tag_CRCStruct
{
   VMCrc32* m_poCRC32;
   TCHAR    m_achFileName[ MAX_PATH + 1 ];
   LPBYTE   m_pbData;
   UINT     m_iSize;
   HWND     m_hWndProgress;
   HANDLE   m_hThread;
}
VM_CRC_THREAD_STRUCT, *P_VM_CRC_THREAD_STRUCT;


#endif


/*****************************************************************************/
/* Check-in history 
   $WorkFile:   $
    $Archive:   $

 *$Log:  $
*/
/*****************************************************************************/


